//
//  MyHomeHeadView.swift
//  DaRings
//
//  Created by 易先生 on 2022/10/27.
//

import UIKit
import MYModule

class MyHomeDeviceHeaderView: View {

    public var isBinding : Bool = false {
        didSet{
            updateDeviceUI()
        }
    }
    
    
    override func makeUI() {
        super.makeUI()
        
       
        
    }
    
    private func updateDeviceUI() {
        self.removeAllSubViews()
        guard isBinding else {
            self.addSubview(unDeviceContainerView)
            unDeviceContainerView.snp.makeConstraints { make in
                make.top.equalToSuperview().offset(10)
                make.leading.equalToSuperview().offset(20)
                make.trailing.equalToSuperview().offset(-20)
                make.bottom.equalToSuperview().offset(-28)
            }
            return
        }
        self.addSubview(deviceContainerView)
        deviceContainerView.snp.makeConstraints { make in
            make.top.equalToSuperview().offset(10)
            make.leading.equalToSuperview().offset(20)
            make.trailing.equalToSuperview().offset(-20)
            make.bottom.equalToSuperview().offset(-20)
        }
    }
    
    public lazy var deviceContainerView: MyHomeDeviceContainerView = {
        let deviceView = MyHomeDeviceContainerView()
        return deviceView
    }()
    
    public lazy var unDeviceContainerView: MyHomeUnDeviceContainerView = {
        let noDeviceView = MyHomeUnDeviceContainerView()
        return noDeviceView
    }()

}
